import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:hook_rent/pages/home/tab_index/index_recommend_data.dart';
import 'package:hook_rent/widgets/image_widget.dart';
import 'package:hook_rent/widgets/text_widgets.dart';

class IndexRecommendItemWidget extends StatelessWidget {
  final IndexRecommendItem data;

  const IndexRecommendItemWidget({super.key, required this.data});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        Get.toNamed(data.navigateUrl);
      },
      child: Container(
        padding: EdgeInsets.all(10.w),
        decoration: const BoxDecoration(
          color: Colors.white,
        ),
        width: (MediaQuery.of(context).size.width - 10.w * 3) / 2,
        child:
            Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
          Column(
            children: [
              text16Normal(text: data.title),
              text14Normal(text: data.subTitle),
            ],
          ),
          ImageWidget(
            data.imageUrl,
            width: 55.w,
            height: 55.h,
          ),
        ]),
      ),
    );
  }
}
